//
// Created on 2024/3/12.
//
// Node APIs are not fully supported. To solve the compilation error of the interface cannot be found,
// please include "napi/native_api.h".

#ifndef OHOS_TextInfoMap_H
#define OHOS_TextInfoMap_H

#include "TextComponentsInfo.h"
#include <bits/alltypes.h>
#include <map>
#include <sys/stat.h>
class TextInfoMap {
    
    public:
        static TextInfoMap *getInstance() {
            if(globalInfoMap == nullptr){
                globalInfoMap = new TextInfoMap();
            }
            return globalInfoMap;
        }

    private:
        static TextInfoMap *globalInfoMap;
        std::unordered_map<int, TextInputInfo*> textInputMap;
        std::unordered_map<int, TextAreaInfo*> textAreaMap;

    private:
        TextInfoMap();
        ~TextInfoMap();
    public:
        TextInputInfo *getTextInputInfo(int32_t viewTag);
        void addTextInputInfo(int32_t viewTag, TextInputInfo *videoPlayerInfo);
        void deleteTextInputByTag(int32_t viewTag);

        TextAreaInfo *getTextAreaInfo(int32_t viewTag);
        void addTextAreaInfo(int32_t viewTag, TextAreaInfo *videoPlayerInfo);
        void deleteTextAreaByTag(int32_t viewTag);
};

#endif //OHOS_TextInfoMap_H
